"""
@author: dlf
@file: 三乐购物系统.py
@time: 2023/3/30 0:59
"""
# 登录及验证
def login(username, passwd):
    if username in user and user[username]['passwd'] == passwd:
        return True
# 注册
def register(username, passwd, money):
    # 用户名是否合法
    if username in user:
        print("用户名已存在，请重新输入！")
    else:
        user[username] = {'passwd':passwd, 'money':money}
        print(f"{username}注册成功")
        print("用户信息已更新".center(26,"-"))
        print(f"{'用户名':<8}{'密码':<10}{'金额':<7}")
        # 逐个打印用户名、密码、金额
        for i in user:
            print(f"{i:<10}{user[i]['passwd']:<12}{user[i]['money']:<10}")
user = {'root':{'passwd':'123456', 'money':100}}
print("欢迎进入三乐购物系统".center(50,"-"))
goodsmess = {'F01':{'name':'苹果','price':2},
             'F02':{'name':'香蕉','price':2},
             'F03':{'name':'梨子','price':1},
             'F04':{'name':'芒果','price':2},
             'F05':{'name':'柚子','price':8},
             'F06':{'name':'西瓜','price':10}}
